<?php if (!defined('THINK_PATH')) exit();?>﻿<!-- <br> 会替换成当前网站的地址（不含域名）
<br> 会替换成当前应用的URL地址 （不含域名）
/Admin<br>会替换成当前模块的URL地址（不含域名）
/Admin/Goods<br>（__或者/Admin/Goods 兼容考虑） 会替换成当前控制器的URL地址（不含域名）
/Admin/Goods/edit<br>会替换成当前操作的URL地址 （不含域名）
/admin/goods/edit/id/41.html<br> 会替换成当前的页面URL
/Public<br>会被替换成当前网站的公共目录 通常是 /Public/
/Public/Admin/<br> 自定义常量:后台
/Public/Home/<br> 自定义常量；前台 -->

<!--依次输出：
 /myshop
/myshop/index.php
/myshop/index.php/Admin
/myshop/index.php/Admin/Index
/myshop/index.php/Admin/Index/index
/myshop/index.php/admin/index/index
/myshop/Public
Public/Admin
Public/Admin
Public/Home
-->



<!DOCTYPE html>
<html lang="en">

	<head>

		<!-- Basic -->
    	<meta charset="UTF-8" />

		<title>Dashboard | Nadhif - Responsive Admin Template</title>

		<!-- Mobile Metas -->
	    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />

		<!-- Import google fonts -->
        <!-- <link href="http://fonts.useso.com/css?family=Open+Sans:300,400,600,700,800|Shadows+Into+Light" rel="stylesheet" type="text/css" /> -->

		<!-- Favicon and touch icons -->
		<link rel="shortcut icon" href="/Public/Admin/assets/ico/favicon.ico" type="image/x-icon" />
		<link rel="apple-touch-icon" href="/Public/Admin/assets/ico/apple-touch-icon.png" />
		<link rel="apple-touch-icon" sizes="57x57" href="/Public/Admin/assets/ico/apple-touch-icon-57x57.png" />
		<link rel="apple-touch-icon" sizes="72x72" href="/Public/Admin/assets/ico/apple-touch-icon-72x72.png" />
		<link rel="apple-touch-icon" sizes="76x76" href="/Public/Admin/assets/ico/apple-touch-icon-76x76.png" />
		<link rel="apple-touch-icon" sizes="114x114" href="/Public/Admin/assets/ico/apple-touch-icon-114x114.png" />
		<link rel="apple-touch-icon" sizes="120x120" href="/Public/Admin/assets/ico/apple-touch-icon-120x120.png" />
		<link rel="apple-touch-icon" sizes="144x144" href="/Public/Admin/assets/ico/apple-touch-icon-144x144.png" />
		<link rel="apple-touch-icon" sizes="152x152" href="/Public/Admin/assets/ico/apple-touch-icon-152x152.png" />

	    <!-- start: CSS file-->

		<!-- Vendor CSS-->
		<link href="/Public/Admin/assets/vendor/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
		<link href="/Public/Admin/assets/vendor/skycons/css/skycons.css" rel="stylesheet" />
		<link href="/Public/Admin/assets/vendor/font-awesome/css/font-awesome.min.css" rel="stylesheet" />

		<!-- Plugins CSS-->
		<link href="/Public/Admin/assets/plugins/bootkit/css/bootkit.css" rel="stylesheet" />
		<link href="/Public/Admin/assets/plugins/scrollbar/css/mCustomScrollbar.css" rel="stylesheet" />
		<link href="/Public/Admin/assets/plugins/fullcalendar/css/fullcalendar.css" rel="stylesheet" />
		<link href="/Public/Admin/assets/plugins/jquery-ui/css/jquery-ui-1.10.4.min.css" rel="stylesheet" />
		<link href="/Public/Admin/assets/plugins/xcharts/css/xcharts.min.css" rel="stylesheet" />
		<link href="/Public/Admin/assets/plugins/morris/css/morris.css" rel="stylesheet" />

		<!-- Theme CSS -->
		<link href="/Public/Admin/assets/css/jquery.mmenu.css" rel="stylesheet" />

		<!-- Page CSS -->
		<link href="/Public/Admin/assets/css/style.css" rel="stylesheet" />
		<link href="/Public/Admin/assets/css/add-ons.min.css" rel="stylesheet" />

		<!-- end: CSS file-->

		<!-- 商品相册上传 -->
		<link href="/Public/Admin/assets/plugins/dropzone/css/dropzone.css" rel="stylesheet" />
		<script src="/Public/Admin/assets/js/pages/form-dropzone.js"></script>
		<script src="/Public/Admin/assets/plugins/dropzone/js/dropzone.min.js"></script>

		<!-- Head Libs -->
		<script src="/Public/Admin/assets/plugins/modernizr/js/modernizr.js"></script>

		<!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
		<!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
		<!--[if lt IE 9]>
			<script src="http://apps.bdimg.com/libs/html5shiv/3.7/html5shiv.min.js"></script>
			<script src="http://apps.bdimg.com/libs/respond.js/1.4.2/respond.js"></script>
		<![endif]-->


		<!-- 头部区块 -->
		
		<style type="text/css">
			.error{color:red;}/* 添加页面校验的错误提示的样式 */
		</style>

	</head>

	<body>

		<!-- Start: Header -->
		<div class="navbar" role="navigation">
			<div class="container-fluid container-nav">
				<!-- Navbar Action -->
				<ul class="nav navbar-nav navbar-actions navbar-left">
					<li class="visible-md visible-lg"><a href="index.html#" id="main-menu-toggle"><i class="fa fa-th-large"></i></a></li>
					<li class="visible-xs visible-sm"><a href="index.html#" id="sidebar-menu"><i class="fa fa-navicon"></i></a></li>
				</ul>
				<!-- Navbar Left -->
				<div class="navbar-left">
					<!-- Search Form -->
					<form class="search navbar-form">
						<div class="input-group input-search">
							<input type="text" class="form-control" name="q" id="q" placeholder="Search...">
							<span class="input-group-btn">
								<button class="btn btn-default" type="submit"><i class="fa fa-search"></i></button>
							</span>
						</div>
					</form>
				</div>
				<!-- Navbar Right -->
				<div class="navbar-right">
					<!-- Notifications -->
					<ul class="notifications hidden-sm hidden-xs">
						<li>
							<a href="#" class="dropdown-toggle notification-icon" data-toggle="dropdown">
								<i class="fa fa-tasks"></i>
								<span class="badge">10</span>
							</a>
							<ul class="dropdown-menu update-menu" role="menu">
								<li><a href="#"><i class="fa fa-database bk-fg-primary"></i> Database </a></li>
								<li><a href="#"><i class="fa fa-bar-chart-o bk-fg-primary"></i> Connection </a></li>
								<li><a href="#"><i class="fa fa-bell bk-fg-primary"></i> Notification </a></li>
								<li><a href="#"><i class="fa fa-envelope bk-fg-primary"></i> Message </a></li>
								<li><a href="#"><i class="fa fa-flash bk-fg-primary"></i> Traffic </a></li>
								<li><a href="#"><i class="fa fa-credit-card bk-fg-primary"></i> Invoices </a></li>
								<li><a href="#"><i class="fa fa-dollar bk-fg-primary"></i> Finances </a></li>
								<li><a href="#"><i class="fa fa-thumbs-o-up bk-fg-primary"></i> Orders </a></li>
								<li><a href="#"><i class="fa fa-folder bk-fg-primary"></i> Directories </a></li>
								<li><a href="#"><i class="fa fa-users bk-fg-primary"></i> Users </a></li>
							</ul>
						</li>
						<li>
							<a href="#" class="dropdown-toggle notification-icon" data-toggle="dropdown">
								<i class="fa fa-envelope"></i>
								<span class="badge">5</span>
							</a>
							<ul class="dropdown-menu">
								<li class="dropdown-menu-header">
									<strong>Messages</strong>
									<div class="progress progress-xs  progress-striped active">
										<div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style="width: 60%;">
											60%
										</div>
									</div>
								</li>
								<li class="avatar">
									<a href="page-inbox.html">
										<img class="avatar" src="/Public/Admin/assets/img/avatar1.jpg" alt="" />
										<div><div class="point point-primary point-lg"></div>New message</div>
										<span><small>1 minute ago</small></span>
									</a>
								</li>
								<li class="avatar">
									<a href="page-inbox.html">
										<img class="avatar" src="/Public/Admin/assets/img/avatar2.jpg" alt="" />
										<div><div class="point point-primary point-lg"></div>New message</div>
										<span><small>3 minute ago</small></span>
									</a>
								</li>
								<li class="avatar">
									<a href="page-inbox.html">
										<img class="avatar" src="/Public/Admin/assets/img/avatar3.jpg" alt="" />
										<div><div class="point point-primary point-lg"></div>New message</div>
										<span><small>4 minute ago</small></span>
									</a>
								</li>
								<li class="avatar">
									<a href="page-inbox.html">
										<img class="avatar" src="/Public/Admin/assets/img/avatar4.jpg" alt="" />
										<div><div class="point point-primary point-lg"></div>New message</div>
										<span><small>30 minute ago</small></span>
									</a>
								</li>
								<li class="avatar">
									<a href="page-inbox.html">
										<img class="avatar" src="/Public/Admin/assets/img/avatar5.jpg" alt="" />
										<div><div class="point point-primary point-lg"></div>New message</div>
										<span><small>1 hours ago</small></span>
									</a>
								</li>
								<li class="dropdown-menu-footer text-center">
									<a href="page-inbox.html">View all messages</a>
								</li>
							</ul>
						</li>
						<li>
							<a href="#" class="dropdown-toggle notification-icon" data-toggle="dropdown">
								<i class="fa fa-bell"></i>
								<span class="badge">3</span>
							</a>
							<ul class="dropdown-menu list-group">
								<li class="dropdown-menu-header">
									<strong>Notifications</strong>
									<div class="progress progress-xs  progress-striped active">
										<div class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style="width: 60%;">
											60%
										</div>
									</div>
								</li>
								<li class="list-item">
									<a href="page-inbox.html">
										<div class="pull-left">
										   <i class="fa fa-envelope-o bk-fg-primary"></i>
										</div>
										<div class="media-body clearfix">
											<div>Unread Message</div>
											<h6>You have 10 unread message</h6>
										</div>
									</a>
								</li>
								<li class="list-item">
									<a href="#">
										<div class="pull-left">
										   <i class="fa fa-cogs bk-fg-primary"></i>
										</div>
										<div class="media-body clearfix">
											<div>New Settings</div>
											<h6>There are new settings available</h6>
										</div>
									</a>
								</li>
								<li class="list-item">
									<a href="#">
										<div class="pull-left">
										   <i class="fa fa-fire bk-fg-primary"></i>
										</div>
										<div class="media-body clearfix">
											<div>Update</div>
											<h6>There are new updates available</h6>
										</div>
									</a>
								</li>
								<li class="list-item-last">
									<a href="#">
									  <h6>Unread notifications</h6>
									  <span class="badge">15</span>
								   </a>
								</li>
							</ul>
						</li>
					</ul>
					<!-- End Notifications -->
					<!-- Userbox -->
					<div class="userbox">
						<a href="#" class="dropdown-toggle" data-toggle="dropdown">
							<div class="profile-info">
								<span class="name"><?php echo ($_SESSION['admin_user']['realname']); ?></span>
								<span class="role">Developer</span>
							</div>
							<i class="fa custom-caret"></i>
						</a>
						<div class="dropdown-menu">
							<ul class="list-unstyled">
								<li class="dropdown-menu-header bk-bg-white bk-margin-top-15">
									<div class="progress progress-xs  progress-striped active">
										<div class="progress-bar progress-bar-primary" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style="width: 60%;">
											60%
										</div>
									</div>
								</li>
								<li>
									<a href="page-profile.html"><i class="fa fa-user"></i> Profile</a>
								</li>
								<li>
									<a href="#"><i class="fa fa-wrench"></i> Settings</a>
								</li>
								<li>
									<a href="page-invoice"><i class="fa fa-usd"></i> Payments</a>
								</li>
								<li>
									<a href="#"><i class="fa fa-file"></i> File</a>
								</li>
								<li>
									<a href="page-login.html"><i class="fa fa-power-off"></i> Logout</a>
								</li>
							</ul>
						</div>
					</div>
					<!-- End Userbox -->
				</div>
				<!-- End Navbar Right -->
			</div>
		</div>
		<!-- End: Header -->
		<div class="copyrights">Collect from <a href="http://www.cssmoban.com/" >企业网站模板</a></div>
		<!-- Start: Content -->
		<div class="container-fluid content">
			<div class="row">

				<!-- Sidebar -->
				<div class="sidebar">
					<div class="sidebar-collapse">
						<!-- Sidebar Header Logo-->
						<div class="sidebar-header">
							<img src="/Public/Admin/assets/img/logo.png" class="img-responsive" alt="" />
						</div>
						<!-- Sidebar Menu-->
						<div class="sidebar-menu">
							<nav id="menu" class="nav-main" role="navigation">
								<ul class="nav nav-sidebar">
									<div class="panel-body text-center">
										<div class="bk-avatar"><!-- src="/Public/Admin/assets/img/avatar.jpg" -->
											<img src="/Public/Admin/assets/img/avatar.jpg" class="img-circle bk-img-60" alt="" />
										</div>
										<div class="bk-padding-top-10">
											<i class="fa fa-circle text-success"></i> <small>Administrator</small>
										</div>
									</div>
									<div class="divider2"></div>
									<li class="active">
										<a href="<?php echo U('index/index');?>">
											<i class="fa fa-laptop" aria-hidden="true"></i><span>系统首页</span>
										</a>
									</li>
									<!-- 循环顶级数据 ||$_SESSION['admin_user']['group_access'][0]=='true'-->
									<?php if(is_array($top_nav)): foreach($top_nav as $key=>$v): if(in_array($v['id'],$_SESSION['admin_user']['group_access'])){ ?>
									<li class="nav-parent">
										<a>
											<i class="fa <?php echo ($v["icon"]); ?>" aria-hidden="true"></i><span><?php echo ($v["title"]); ?></span>
										</a>
										<ul class="nav nav-children">
											<!-- 循环子级 ||$_SESSION['admin_user']['group_access'][0]=='true'-->
											<?php if(is_array($child_nav)): foreach($child_nav as $key=>$vo): if(in_array($vo['id'],$_SESSION['admin_user']['group_access'])){ ?>
												<?php if(($v['id']) == $vo['pid']): ?><li>
												<a href="<?php echo U($vo['name']);?>"><!-- 导航的路径 -->
												<i class="fa <?php echo ($vo["icon"]); ?>" aria-hidden="true"></i>
												<span class="text"><?php echo ($vo["title"]); ?></span></a>
											</li><?php endif; ?>
											<?php } endforeach; endif; ?>
										</ul>
									</li>
									<?php } endforeach; endif; ?>
								</ul>
							</nav>
						</div>
						<!-- End Sidebar Menu-->
					</div>
					<!-- Sidebar Footer-->
					<div class="sidebar-footer">

					</div>
					<!-- End Sidebar Footer-->
				</div>
				<!-- End Sidebar -->

				<!-- Main Page -->
				<div class="main ">
					<!-- Page Header -->
					<div class="page-header">
						<div class="pull-left">
							<ol class="breadcrumb visible-sm visible-md visible-lg">
								<li><a href="index.html"><i class="icon fa fa-home"></i>Home</a></li>
								<li class="active"><i class="fa fa-laptop"></i>Dashboard</li>
							</ol>
						</div>
						<div class="pull-right">
							<h2>Dashboard</h2>
						</div>
					</div>


				<!-- 可变内容区域代码部分 -->
			

<div class="row">
	<div class="col-md-9">
		<div class="panel">
			<div class="panel-heading bk-bg-primary">
				<h6><i class="fa fa-indent red"></i>添加商品</h6>
			</div>
			<div class="panel-body">
			<!-- action=""没有值 ，则默认提交到当前路径-->
				<form action="" method="post" enctype="multipart/form-data" class="form-horizontal ">

					<div class="form-group">
							<label class="col-md-2 control-label" for="file-input">图片</label>
							<div class="col-md-9">
								<input id="file-multiple-input" name="file" multiple type="file">
							</div>
						</div>


					<div class="form-group">
						<label class="col-md-2 control-label" for="text-input">商品名称</label>
						<div class="input-group">
							<input id="input1-group1" name="goods_name" class="form-control" placeholder="请输入商品名称" type="text">
							<span class="input-group-addon"><i class="fa fa-user"></i></span>
						</div>
					</div>
					<div class="form-group">
						<label class="col-md-2 control-label" for="select">品牌分类</label>
						<div class="col-md-3">
							<select id="select" name="brand_id" class="form-control" size="1">
								<option value="0">请选择品牌分类</option>
								<?php if(is_array($brand_list)): foreach($brand_list as $key=>$v): ?><option value="<?php echo ($v["id"]); ?>"><?php echo ($v["name"]); ?></option><?php endforeach; endif; ?>
							</select>
						</div>
					</div>
					<div class="form-group">
						<label class="col-md-2 control-label" for="select">分类</label>
						<div class="col-md-3">
							<select id="select" name="cate_id" class="form-control" size="1">
								<option value="0">请选择分类</option>
								<?php if(is_array($cate_list)): foreach($cate_list as $key=>$v): ?><option value="<?php echo ($v["id"]); ?>"><?php echo ($v["name"]); ?></option><?php endforeach; endif; ?>
							</select>
						</div>
					</div>
					<div class="form-group">
						<label class="col-md-2 control-label" for="select">商品类型</label>
						<div class="col-md-3">
							<select id="goods_type"  class="form-control" size="1">
								<option value="0">请选择商品类型</option>

								<?php if(is_array($goods_type_list)): foreach($goods_type_list as $key=>$v): ?><option value="<?php echo ($v["id"]); ?>"><?php echo ($v["name"]); ?></option><?php endforeach; endif; ?>

							</select>
						</div>
					</div>
					<div class="form-group">
						<label class="col-md-2 control-label" for="select">商品规格项</label>
						<div class="input-group col-md-8">
							<div class="row">
								<div class="col-md-20 spec_item">


									<!-- <div class="toggle" data-plugin-toggle="">
										<div class=" active">
											<label for="inline-checkbox<?php echo ($v["id"]); ?>">颜色</label>
											<div class="toggle-content" style="display: block;">
												<div class="form-group">
													<div class="col-md-3 input-daterange input-inline" data-plugin-datepicker="">
														<input class="form-control" value="土豪金" disabled type="text">
														<span class="input-group-addon">+</span>
														<input  class="col-md-2 form-control" name="end" type="text">
													</div>

														<div class="col-md-3 input-daterange input-inline" data-plugin-datepicker="">
														<input class="form-control" value="玫瑰红"  disabled type="text">
														<span class="input-group-addon">+</span>
														<input  class="col-md-2 form-control" name="end" type="text">
													</div>
												</div>
											</div>
										</div>
									</div> -->
								</div>
								<div id="spec_list">

								</div>

								<!--
								<div class="table-responsive">
									<table class="table table-striped table-bordered bootstrap-datatable datatable dataTable no-footer">
										<thead>
										<tr>
											<th width="100">规格总计</th>
											<th width="100">库存</th>
											<th width="100">规格描述</th>
											<th width="100">操作</th>
										</tr>
										</thead>
										<tbody>
											<tr>
												<td>7</td>
												<td>数码</td>
												<td>数码</td>
												<td>
													<a class="btn btn-danger" href="table.html#">
													<i class="fa fa-trash-o "></i></a>
												</td>
											</tr>
										</tbody>
									</table>
								</div>
 -->



							</div>
						</div>
					</div>
					<div class="form-group">
						<label class="col-md-2 control-label" for="email-input">市场价</label>
						<div class="input-group">
							<input id="input1-group1" name="marke_price" class="form-control" placeholder="请输入市场价" type="text">
							<span class="input-group-addon"><i class="fa fa-key"></i></span>
						</div>
					</div>
					<div class="form-group">
						<label class="col-md-2 control-label" for="email-input">本店价</label>
						<div class="input-group">
							<input id="input1-group1" name="shop_price" class="form-control" placeholder="请输入本店价" type="text">
							<span class="input-group-addon"><i class="fa fa-key"></i></span>
						</div>
					</div>
					<div class="form-group">
						<label class="col-md-2 control-label">上架</label>
						<div class="input-group col-md-9">
							<div class="radio-custom radio-inline">
								<input id="inline-radio1" name="is_down" value="1" type="radio">
								<label for="inline-radio1">是</label>
							</div>
							<div class="radio-custom radio-inline">
								<input id="inline-radio2" name="is_show"  value="0" type="radio">
								<label for="inline-radio2">否</label>
							</div>
						</div>
					</div>
					<div class="form-group">
						<label class="col-md-2 control-label">新品</label>
						<div class="input-group col-md-9">
							<div class="radio-custom radio-inline">
								<input id="inline-radio1" name="is_new" value="1" type="radio">
								<label for="inline-radio1">是</label>
							</div>
							<div class="radio-custom radio-inline">
								<input id="inline-radio2" name="is_show"  value="0" type="radio">
								<label for="inline-radio2">否</label>
							</div>
						</div>
					</div>
					<div class="form-group">
						<label class="col-md-2 control-label">热销</label>
						<div class="input-group col-md-9">
							<div class="radio-custom radio-inline">
								<input id="inline-radio1" name="is_hot" value="1" type="radio">
								<label for="inline-radio1">是</label>
							</div>
							<div class="radio-custom radio-inline">
								<input id="inline-radio2" name="is_show"  value="0" type="radio">
								<label for="inline-radio2">否</label>
							</div>
						</div>
					</div>

					 <div class="form-group">
	                  <label class="col-md-2 control-label" for="text-input">商品描述</label>
	                    <div class="input-group">
	                       <script id="editor" name="desc" type="text/plain" style="width:100%;height:500px;"></script>
	                    </div>
	                </div>

					<button type="submit" class="bk-margin-5 btn btn-success">提交</button>
					<button type="button" class="bk-margin-5 btn btn-success">规格项录入</button>
				</form>
			</div>
		</div>
	</div>
</div>




				</div>
				<!-- End Main Page -->


			</div>
		</div><!--/container-->


		<!-- Modal Dialog -->
		<div class="modal fade" id="myModal">
			<div class="modal-dialog">
				<div class="modal-content">
					<div class="modal-header">
						<button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
						<h4 class="modal-title bk-fg-primary">Modal title</h4>
					</div>
					<div class="modal-body">
						<p class="bk-fg-danger">Here settings can be configured...</p>
					</div>
					<div class="modal-footer">
						<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
						<button type="button" class="btn btn-primary">Save changes</button>
					</div>
				</div>
			</div>
		</div><!-- End Modal Dialog -->

		<div class="clearfix"></div>


		<!-- start: JavaScript-->

		<!-- Vendor JS-->

		<script src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js"></script>
		<script src="/Public/Admin/assets/vendor/js/jquery-migrate-1.2.1.min.js"></script>
		<script src="/Public/Admin/assets/vendor/bootstrap/js/bootstrap.min.js"></script>
		<script src="/Public/Admin/assets/vendor/skycons/js/skycons.js"></script>

		<!-- Plugins JS-->
		<script src="/Public/Admin/assets/plugins/jquery-ui/js/jquery-ui-1.10.4.min.js"></script>
		<script src="/Public/Admin/assets/plugins/scrollbar/js/jquery.mCustomScrollbar.concat.min.js"></script>
		<script src="/Public/Admin/assets/plugins/bootkit/js/bootkit.js"></script>
		<script src="/Public/Admin/assets/plugins/moment/js/moment.min.js"></script>
		<script src="/Public/Admin/assets/plugins/fullcalendar/js/fullcalendar.min.js"></script>
		<script src="/Public/Admin/assets/plugins/touchpunch/js/jquery.ui.touch-punch.min.js"></script>
		<script src="/Public/Admin/assets/plugins/flot/js/jquery.flot.min.js"></script>
		<script src="/Public/Admin/assets/plugins/flot/js/jquery.flot.pie.min.js"></script>
		<script src="/Public/Admin/assets/plugins/flot/js/jquery.flot.resize.min.js"></script>
		<script src="/Public/Admin/assets/plugins/flot/js/jquery.flot.stack.min.js"></script>
		<script src="/Public/Admin/assets/plugins/flot/js/jquery.flot.time.min.js"></script>
		<script src="/Public/Admin/assets/plugins/xcharts/js/xcharts.min.js"></script>
		<script src="/Public/Admin/assets/plugins/autosize/jquery.autosize.min.js"></script>
		<script src="/Public/Admin/assets/plugins/placeholder/js/jquery.placeholder.min.js"></script>
		<script src="/Public/Admin/assets/plugins/datatables/js/dataTables.bootstrap.min.js"></script>
		<script src="/Public/Admin/assets/plugins/datatables/js/jquery.dataTables.min.js"></script>
		<script src="/Public/Admin/assets/plugins/raphael/js/raphael.min.js"></script>
		<script src="/Public/Admin/assets/plugins/morris/js/morris.min.js"></script>
		<script src="/Public/Admin/assets/plugins/gauge/js/gauge.min.js"></script>
		<script src="/Public/Admin/assets/plugins/d3/js/d3.min.js"></script>
		<!--<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>  delete by templatesy.com (because of google)-->

		<!-- Theme JS -->
		<script src="/Public/Admin/assets/js/jquery.mmenu.min.js"></script>
		<script src="/Public/Admin/assets/js/core.min.js"></script>

		<!-- Pages JS -->
		<script src="/Public/Admin/assets/js/pages/index.js"></script>

		<!-- end: JavaScript-->
	<!-- 尾部区块 -->
		<!--  -->
	</body>

</html>
<!-- js区块 -->


	<script src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js"></script>
	<script type="text/javascript" src="/Public/Admin/assets/js/jquery.validate.min.js"></script>

	<!-- 百度编辑器js文件 -->
	<script type="text/javascript" charset="utf-8" src="/Public/Admin/ueditor/ueditor.config.js"></script>
	<script type="text/javascript" charset="utf-8" src="/Public/Admin/ueditor/ueditor.all.min.js"> </script>

	<script type="text/javascript">
		$(function(){
			 var ue = UE.getEditor('editor');//初始化百度编辑器


			 //选择商品类型的时候，会在规格项那里追加规格项数据
			 //根据选择的商品类型显示对应的规格
			 $('#goods_type').change(function() {
			 	//先获取选中项的ID
			 	var id=$(this).val();

			 	$.ajax({
			 		type:'get',
			 		url:'<?php echo U("Admin/ajax/getSpec");?>',
			 		data:{
			 			'id':id,
			 		},
			 		dataType:'json',
			 		success:function(e){

			 			var html='';

			 			for (i in e) {
			 				html+='<div class="toggle" data-plugin-toggle="">';
							html+='<div style="margin-left:20px;" class=" active">';
							html+='<label for="inline-checkbox">'+e[i].spec_name+'</label>';
							html+='<div class="toggle-content" style="display: block;">';

							for (j in e[i]['spec_item']) {
							html+='<div class="col-md-3 input-daterange input-inline" data-plugin-datepicker="">';
							html+='<input class="form-control" value="'+e[i]['spec_item'][j]['name']+'" disabled type="text">';
							var desc=e[i].spec_name+':'+e[i]['spec_item'][j]['name'];
							html+='<span class="input-group-addon span-btn" spec-id='+e[i]['spec_item'][j]['id']+'  spec-desc="'+desc+'"><b>+</b></span>';
								html+='</div>';
							}

							html+='</div>';
							html+='</div>';
							html+='</div>';
							html+='</div>';
			 			}

			 			//拼接库存
			 			html+='<div class="toggle" data-plugin-toggle="">';
							html+='<div style="margin-left:20px;" class=" active">';
								html+='<label for="inline-checkbox">规格库存</label>';
								html+='<div class="toggle-content" style="display: block;">';

									html+='<div class="col-md-2 input-daterange input-inline" data-plugin-datepicker="">';
										html+='<input class="form-control" name="spec_num" type="text">';
										html+='</div>';
									html+='</div>';
								html+='</div>';
							html+='</div>';
						html+='</div>';


						//追加html
			 			$('.spec_item').html(html);
			 			// alert(html);

			 			//实现点击显示的规格项的后面的span，追加一个input
			 			//实现在规格项后面输入价格
			 			$('.span-btn').click(function() {
			 				// alert(123123);

			 				var icon=$(this).text();//先获取span标签的文本内容
			 				if (icon=='+') {
			 					//将所有的规格的未禁用的input输入框都删除掉
				 				$(this).parent().parent().find(':text[name="price"]').remove();
				 				//将所有的按钮都改成+号
				 				$(this).parent().parent().find('span').text('+');
			 					$(this).text('-');
			 					var inp='<input  class="col-md-7 form-control" name="price" type="text">';
			 					$(this).after(inp);//在inp之后追加
			 				}else{
			 					$(this).text('+');
			 					$(this).next().remove();
			 				}

			 			});
			 		}
			 	})

			 });


			 //规格录入
			 $(':button').click(function() {

			 	//抓取所有录入的规格单价
			 	//抓取规格项中name=price的标签
			 	var price =$('.spec_item input[name="price"]');
			 	//规格项单价循环累计
			 	var _total_price=0;//规格总价格
			 	var _specDesc='';//规格描述
			 	var _sepc_id='';//规格规则
			 	var _num =$(':text[name="spec_num"]').val();//规格库存

			 	//抓取要录入的规格数量
			 	var spec_len=$('.toggle').length;
			 	var text_len=price.length+1;
			 	// alert(price.length);
			 	// alert(spec_len);

			 	if (text_len!=spec_len) {
			 		alert('请将录入信息填写完');
			 		return false;
			 	}

			 	//$(obj)是文本框
			 	price.each(function(i,obj){
			 		_total_price+=parseInt($(obj).val());
			 		_specDesc+=$(obj).prev().attr('spec-desc')+'&nbsp;';//规格描述
			 		_sepc_id+='_'+$(obj).prev().attr('spec-id');//规格规则
			 	})

			 	$.ajax({
			 		url:'<?php echo U("Admin/ajax/append_spec");?>',
			 		type:'post',
			 		data:{
			 			'spec_rules':_sepc_id,
			 			'num':_num,
			 			'spec_price':_total_price,
			 			'spec_desc':_specDesc,
			 		},
			 		dataType:'json',
			 		success:function(e){
			 			//根据数据做一个循环拼接
		 				var html='';
					 	html+='<div class="table-responsive">';
							html+='<table class="table table-striped table-bordered bootstrap-datatable datatable dataTable no-footer">';
								html+='<thead>';
								html+='<tr>';
									html+='<th width="100">规格总计</th>';
									html+='<th width="100">库存</th>';
									html+='<th width="100">规格描述</th>';
									html+='<th width="100">操作</th>';
								html+='</tr>';
								html+='</thead>';
								for(i in e){
								html+='<tbody>';
									html+='<tr>';
									html+='<td>'+e[i].spec_rules+'</td>';
										html+='<td width="100">'+e[i].spec_price+'</td>';
										html+='<td>'+e[i].num+'</td>';
										html+='<td width="800">'+e[i].spec_desc+'</td>';
										html+='<td>';
										html+='	<a class="btn btn-danger" href="table.html#">';
										html+='	<i class="fa fa-trash-o "></i></a>';
										html+='</td>';
									html+='</tr>';
								html+='</tbody>';
								}
							html+='</table>';
						html+='</div>';

						$('#spec_list').after(html);//追加
						// $('#spec_list').html(html);//替换,写入规格列表
			 		}
			 	})


			 });

		})
	</script>